package com.strategy.controller;

import com.strategy.config.SystemConfig;
import com.strategy.strategy.context.UploadStrategyContext;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * ClassName:UploadController
 * Package:com.strategy.controller
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/7/16 - 22:29
 * @Version:v1.0
 */
@RestController
@RequiredArgsConstructor
public class UploadController {

    private final UploadStrategyContext uploadStrategyContext;

    @PostMapping("/upload")
    public String upload(MultipartFile file){
        //指定上传文件以及上传方式。
        return uploadStrategyContext.executeUploadStrategy(file, SystemConfig.OSS_STRATEGY);
    }
}
